/**
 * 
 */
package cre.simple.jpa.dao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import cre.simple.jpa.domain.AccountInfo;

/**
 * @author Cre.Gu
 *
 */
public class UserDaoImpl implements UserDao {

	public AccountInfo save(AccountInfo accountInfo) {
		EntityManagerFactory emf = Persistence.createEntityManagerFactory("SimpleJpa");
		EntityManager em = emf.createEntityManager();

		em.getTransaction().begin();
		em.persist(accountInfo);

		em.getTransaction().commit();
		emf.close();

		return accountInfo;
	}
}
